package br.edu.com1263.dao;

import java.util.Collection;

import javax.persistence.Query;

import br.edu.com1263.model.Tarefa;

public class TarefaDAOImpl extends AbstractDAO implements TarefaDAO{
	
	public TarefaDAOImpl(){

}

	

	@Override
	public Collection<Tarefa> consultarTodos() {
		Query query = manager.createQuery("SELECT t FROM Tarefa t");
		return query.getResultList();
	}

	@Override
	public void salvar(Tarefa tarefa) {
		manager.persist(tarefa);
		
	}
	
	
	public void alterar(Tarefa tarefa) {
		manager.merge(tarefa);
	}
    
    public void remover(Tarefa tarefa) {
		manager.remove(tarefa);
	}

	@Override
	public Tarefa consultar(Long id) {
		return manager.find(Tarefa.class, id);
	}
}


	